package com.imagefake.controller;

import com.imagefake.entity.PredictedRecord;
import com.imagefake.service.PredictedRecordService;
import com.imagefake.vo.HttpResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * (PredictedRecord)表控制层
 *
 * @author wj
 * @since 2024-05-06 23:21:13
 */
@RestController
@RequestMapping("/predictedRecord")
public class PredictedRecordController {

    @Resource
    private PredictedRecordService predictedRecordService;

    @GetMapping("/list/{userId}")
    public HttpResult listByUserId(@PathVariable("userId") Integer userId){
        List<PredictedRecord> predictedRecordList = predictedRecordService.listByUserId(userId);
        if(predictedRecordList == null){
            return new HttpResult(-1,"查询记录失败");
        }
        return new HttpResult(200,"查询记录成功",predictedRecordList);
    }

}

